package com.java.threadLocal.multiThread;

public class SequenceNumber {
	//通过匿名内部类覆盖ThreadLocal的initialValue()方法，指定初始值
	private static ThreadLocal<Integer> seNum = new ThreadLocal<Integer>() {
		protected Integer initialValue() {
			return 0 ;
		}
	} ;
	
	public Integer getNextNum(){
        seNum.set(seNum.get()+1);
        return seNum.get();
    }
}
